home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gxcmap.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  4.7 KB  |  118 lines

  1. /* Copyright (C) 1989, 1995, 1996, 1997 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gxcmap.h,v 1.2 2000/09/19 19:00:35 lpd Exp $ */
  20. /* Color mapping procedures */
  21. /* Requires gxdcolor.h. */
  22.  
  23. #ifndef gxcmap_INCLUDED
  24. #  define gxcmap_INCLUDED
  25.  
  26. #include "gscsel.h"
  27. #include "gxfmap.h"
  28.  
  29. #ifndef gx_device_DEFINED
  30. #  define gx_device_DEFINED
  31. typedef struct gx_device_s gx_device;
  32. #endif
  33. #ifndef gx_device_color_DEFINED
  34. #  define gx_device_color_DEFINED
  35. typedef struct gx_device_color_s gx_device_color;
  36. #endif
  37.  
  38. /* Procedures for rendering colors specified by fractions. */
  39.  
  40. #define cmap_proc_gray(proc)\
  41.   void proc(P5(frac, gx_device_color *, const gs_imager_state *,\
  42.            gx_device *, gs_color_select_t))
  43. #define cmap_proc_rgb(proc)\
  44.   void proc(P7(frac, frac, frac, gx_device_color *, const gs_imager_state *,\
  45.            gx_device *, gs_color_select_t))
  46. #define cmap_proc_cmyk(proc)\
  47.   void proc(P8(frac, frac, frac, frac, gx_device_color *,\
  48.            const gs_imager_state *, gx_device *, gs_color_select_t))
  49. #define cmap_proc_rgb_alpha(proc)\
  50.   void proc(P8(frac, frac, frac, frac, gx_device_color *,\
  51.            const gs_imager_state *, gx_device *, gs_color_select_t))
  52.  
  53. /* Because of a bug in the Watcom C compiler, */
  54. /* we have to split the struct from the typedef. */
  55. struct gx_color_map_procs_s {
  56.     cmap_proc_gray((*map_gray));
  57.     cmap_proc_rgb((*map_rgb));
  58.     cmap_proc_cmyk((*map_cmyk));
  59.     cmap_proc_rgb_alpha((*map_rgb_alpha));
  60. };
  61. typedef struct gx_color_map_procs_s gx_color_map_procs;
  62.  
  63. /*
  64.  * Determine the color mapping procedures for a device.  Even though this
  65.  * does not currently use information from the imager state, it must be
  66.  * a virtual procedure of the state for internal reasons.
  67.  */
  68. const gx_color_map_procs *
  69.     gx_get_cmap_procs(P2(const gs_imager_state *, const gx_device *));
  70. const gx_color_map_procs *
  71.     gx_default_get_cmap_procs(P2(const gs_imager_state *, const gx_device *));
  72.  
  73. /*
  74.  * Set the color mapping procedures in the graphics state.  This is
  75.  * currently only needed when switching devices, but might be used more
  76.  * often in the future.
  77.  */
  78. void gx_set_cmap_procs(P2(gs_imager_state *, const gx_device *));
  79.  
  80. /* Remap a concrete (frac) gray, RGB or CMYK color. */
  81. /* These cannot fail, and do not return a value. */
  82. #define gx_remap_concrete_gray(cgray, pdc, pis, dev, select)\
  83.   ((pis)->cmap_procs->map_gray)(cgray, pdc, pis, dev, select)
  84. #define gx_remap_concrete_rgb(cr, cg, cb, pdc, pis, dev, select)\
  85.   ((pis)->cmap_procs->map_rgb)(cr, cg, cb, pdc, pis, dev, select)
  86. #define gx_remap_concrete_cmyk(cc, cm, cy, ck, pdc, pis, dev, select)\
  87.   ((pis)->cmap_procs->map_cmyk)(cc, cm, cy, ck, pdc, pis, dev, select)
  88. #define gx_remap_concrete_rgb_alpha(cr, cg, cb, ca, pdc, pis, dev, select)\
  89.   ((pis)->cmap_procs->map_rgb_alpha)(cr, cg, cb, ca, pdc, pis, dev, select)
  90.  
  91. /* Map a color, with optional tracing if we are debugging. */
  92. #include "gxcindex.h"
  93. #include "gxcvalue.h"
  94. gx_color_index gx_proc_map_rgb_color(P4(gx_device *,
  95.                gx_color_value, gx_color_value, gx_color_value));
  96. gx_color_index gx_proc_map_rgb_alpha_color(P5(gx_device *,
  97.        gx_color_value, gx_color_value, gx_color_value, gx_color_value));
  98. gx_color_index gx_proc_map_cmyk_color(P5(gx_device *,
  99.        gx_color_value, gx_color_value, gx_color_value, gx_color_value));
  100. #ifdef DEBUG
  101. /* Use procedures in gxcmap.c */
  102. #  define gx_map_rgb_color(dev, vr, vg, vb)\
  103.      gx_proc_map_rgb_color(dev, vr, vg, vb)
  104. #  define gx_map_rgb_alpha_color(dev, vr, vg, vb, va)\
  105.      gx_proc_map_rgb_alpha_color(dev, vr, vg, vb, va)
  106. #  define gx_map_cmyk_color(dev, vc, vm, vy, vk)\
  107.      gx_proc_map_cmyk_color(dev, vc, vm, vy, vk)
  108. #else
  109. #  define gx_map_rgb_color(dev, vr, vg, vb)\
  110.      (*dev_proc(dev, map_rgb_color))(dev, vr, vg, vb)
  111. #  define gx_map_rgb_alpha_color(dev, vr, vg, vb, va)\
  112.      (*dev_proc(dev, map_rgb_alpha_color))(dev, vr, vg, vb, va)
  113. #  define gx_map_cmyk_color(dev, vc, vm, vy, vk)\
  114.      (*dev_proc(dev, map_cmyk_color))(dev, vc, vm, vy, vk)
  115. #endif
  116.  
  117. #endif /* gxcmap_INCLUDED */
  118.